package cn.logicalthing.demo.web.controller;

import cn.logicalthing.demo.web.error.CommonErrorCode;
import cn.logicalthing.demo.web.error.RequestBean;
import com.core.bean.UserAddress;
import com.core.dao.IUserAddressDao;
import com.core.dao.mybatismysql.UserAddressDao;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserAddressController {

    @PostMapping("/addUserAddress")
    public RequestBean add(UserAddress userAddress) {
        IUserAddressDao userAddressDao = new UserAddressDao();
        try {
            int add = userAddressDao.add(userAddress);
            return new RequestBean("添加成功");
        } catch (Exception e) {
            return new RequestBean(CommonErrorCode.E_3006);
        }
    }
}
